<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="test"></div>
    <script src="../lib/react.development.js"></script>
  <script src="../lib/react-dom.development.js"></script>
  <script src="../lib/babel.min.js"></script>
  <script type="text/babel">
      class MyComponent extends React.Component{
    constructor(props){
        super(props)
        this.name=props.name
        this.age=props.age
         this.demo=this.demo.bind(this)
        console.log(this,props)
    }
          render(){
              console.log(this)
               return <h2 onClick={this.demo}>你好呀类组件{this.name}</h2>
          }
          demo(){
              console.log('我点击了',this)
          }
      }
      ReactDOM.render(<MyComponent name='天有不测风云' age='12'/>,document.getElementById('test'))
    //   const w=new MyComponent()
    //   console.log(w)
      </script>
</body>
</html>